<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html class="no-js">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>沃店</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/amazeui.min
.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/app.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/index.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/jquery-labelauty.css">
    <!--必要样式-->
    <style type="text/css">
        body {
            background-color: #fff;
        }

        .order {
            margin-top: 20px;
        }

        .am-selected {
            width: 100%;
        }

        .am-selected-status {
            color: #FEB74D;
        }

        .equipment {
            border: 1px #e6e6e6 solid;
            width: 100%;
            height: auto;
            overflow: auto;
            margin-top: 20px;
            border-radius: 2px;
            padding-top: 5px;
            padding-bottom: 5px;
        }

        li {
            list-style: none;
        }

        input[type="checkbox"] {
            margin: 5px 5px 0px 5px;
            display: none;
        }

        .type label {
            cursor: pointer;
            padding-left: 20px;
            line-height: 16px;
            margin-top: 3px;
            margin-left: 3px;
            background: url(${pageContext.request.contextPath}/images/circle.png) no-repeat;
        }

        .radio-label:checked + label {
            background: url(${pageContext.request.contextPath}/images/draw.png) no-repeat;
        }

        .label_checked {
            background: url(${pageContext.request.contextPath}/images/draw.png) no-repeat;
        }
    </style>
</head>

<body>
<header data-am-widget="header" class="am-header am-header-default am-header-fixed">
    <div class="am-header-left am-header-nav">
        <a href="${pageContext.request.contextPath}/clientHome/goNewBroadband" class="">
            <i class="am-header-icon am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <a href="#title-link" class="">
            选择订购套餐
        </a>
    </h1>
    <div class="am-header-right am-header-nav">
        <a href="${pageContext.request.contextPath}/clientHome/index" class="">
            <i class="am-header-icon am-icon-home"></i>
        </a>
    </div>
</header>
<div class="am-g">
    <div class="clearpadding am-u-sm-12">
        <img src="${pageContext.request.contextPath}/images/broadband.png" style="width: 100%;">
    </div>
</div>
<div class="am-g order">
    <div class="am-u-sm-12">
        <select data-am-selected id="area">
            <option>片区选择</option>
            <option v-for="item in regionlist" v-bind:value="item.id">{{item.organizationName}}</option>
        </select>
    </div>
</div>
<div class="am-g">
    <div class="am-u-sm-12 ">
        <div class="equipment">
            <div class="am-u-sm-4 font_orange">
                宽带设备
            </div>
            <div class="am-u-sm-8">
                <i class="am-icon-caret-down" style="float:right;margin-right: -5px;"></i>
            </div>
            <div class="am-u-sm-12 type" style="margin-top: 20px;" id="equip">
                <template v-for="item in equips">
                    <input type="checkbox" :id="item.id" name="staff" :value="item.id" class="radio-label">
                    <label :name="item.id" class="staff">{{item.deviceName}}</label>
                </template>
            </div>

        </div>
    </div>
</div>
<div class="am-g" align="center" style="margin-top: 70px;">
    <a href="#" onclick="next()"><img src="${pageContext.request.contextPath}/images/next.png"></a>
</div>
<!--[if (gte IE 9)|!(IE)]><!-->
<script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>

<script src="${pageContext.request.contextPath}/assets/js/vue.js"></script>
<script src="${pageContext.request.contextPath}/layer/layer.js"></script>

<script type="text/javascript">
    var area = new Vue({
        el: "#area",
        data: {
            regionlist: []
        }
    });
    var equip;
    $.ajax({
        type: "get",
        async: false,
        url: '${pageContext.request.contextPath}/clientOrg/getAll',
        dataType: 'json',
        success: function (data) {

            if (data.success == true && data.code == 200) {
                area.regionlist = data.obj;
                console.log(data.obj);
                $("#area").change(function () {
                    var html = $(".am-selected-status").text();
                    html = "片区选择" + "<font style='color:#000;margin-left:10px;'>" + html + "</font>";
                    $(".am-selected-status").text("").html(html);
                });
            }
        },
        error: function () {
            layer.msg('网络超时');
        }

    });
    $(function () {

    });
    $.ajax({
        type: "get",
        async: false,
        url: '${pageContext.request.contextPath}/clientDevice/getAll',
        dataType: 'json',
        success: function (data) {
            if (data.success == true && data.code == 200) {
                equip= new Vue({
                    el: "#equip",
                    data: {
                        equips: data.obj
                    }
                });
                $(".staff").each(function () {
                    $(this).attr("for", $(this).prev().val());
                });
                $(".staff").click(function() {

                    if($(this).attr("checked")) {
                        $(this).removeAttr("checked");

                    }else {
                        $(this).attr("checked","checked");

                    }
                });
            }

        },
        error: function () {
            layer.msg('网络超时');
        }

    });
    function next() {
        var area = $("#area").val();
        var equip = '';
        $("label[checked]").each(function (index, item) {
            console.log(1);

            if (index == 0) {
                equip = $(this).prev().val();
            } else {
                equip = equip + ',' + $(this).prev().val();
            }

        });
        //console.log(area);
        if (area == "片区选择") {
            layer.msg('请选择片区');
            return;
        }
        console.info(equip);
       window.location.href = "${pageContext.request.contextPath}/clientHallOrder/selectOrgAndDevice?orgId=" + area + "&devices=" + equip;
    }
</script>
<script src="${pageContext.request.contextPath}/assets/js/amazeui.min.js"></script>
</body>

</html>
